502 After Restart: Google Ads Docs YAML Frontmatter Fix
This document records the incident where brain.id86.net returned 502 Bad Gateway after restarting the docusaurus container, and the fix that restored service.
Issue Observed
brain.id86.netstayed on502for more than 3 minutes aftersudo docker restart docusaurus.- The
docusauruscontainer was not just "building" - it was failing and restarting.
Diagnosis
- Check container status:
sudo docker ps -a --filter "name=^docusaurus$" --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"
If the status shows Restarting (...), Docusaurus is in a crash loop (not a normal build window).
- Read the build logs and look for YAML parsing errors:
sudo docker logs docusaurus --tail 200
The logs showed a frontmatter parsing failure similar to:
YAMLException: incomplete explicit mapping pair ...
Can't process doc metadata for doc at path=/app/docs/visibility/ads/google-ads/01-seo-to-ppc-foundations/01-ppc-vs-seo.mdx
Root Cause
The Google Ads education docs included YAML frontmatter with a colon (:) in the title value, without quotes.
Example of the invalid frontmatter:
---
title: PPC vs SEO: Same Searcher, Different Rules
---
In YAML, a colon is a special character. When a frontmatter value contains a colon, wrap the value in double quotes.
Correct frontmatter:
---
title: "PPC vs SEO: Same Searcher, Different Rules"
---
This is the same class of issue described in docs/knowledge/docusaurus/10. Troubleshooting/troubleshooting-yaml-syntax-and-links.mdx.
Recovery Applied
- Quote frontmatter titles containing colons in these files:
docs/visibility/ads/google-ads/01-seo-to-ppc-foundations/01-ppc-vs-seo.mdxdocs/visibility/ads/google-ads/01-seo-to-ppc-foundations/03-metrics-glossary-for-seo.mdxdocs/visibility/ads/google-ads/14-exercises-templates-and-glossary/03-glossary.mdx
- Restart Docusaurus:
sudo docker restart docusaurus
Verification
- Confirm the build reached serve mode:
sudo docker logs docusaurus --tail 120
Expected success line:
[SUCCESS] Serving "build" directory at: http://0.0.0.0:3000/
- Confirm the public endpoint is no longer 502 (Cloudflare Access usually returns a 302):
sudo curl -I -m 15 https://brain.id86.net
Preventive Actions
- Treat this as a content lint rule: if
title,sidebar_label, or similar frontmatter fields contain:, wrap them in double quotes. - Preflight scan for risky titles before a restart:
sudo rg -n '^title: [^\"]*: ' /opt/docker-data/apps/docusaurus/site/docs -g '*.mdx'
- If you see a 502 after restart, distinguish:
- build window (container is
Upand compiling) vs - crash loop (container is
Restarting (...))
- build window (container is